package operations;

import book.Booklist;

import java.util.Scanner;

public class FindOperation implements Operation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("查找图书......");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入你要查找的书的书名");
        String name = scanner.nextLine();

        for (int i = 0; i < booklist.getUesdSize(); i++){
            if (booklist.getBook(i).getName().equals(name)){
                System.out.println("查找成功");
                System.out.println(booklist.getBook(i));
                return;
            }
        }
        System.out.println("查无此书");
    }
}
